#define _CRT_SECURE_NO_WARNINGS 1
#include <vector>
#include <iostream>
using namespace std;

void quick_sort(vector<int>& arr, int left, int right)
{
	if (left >= right)
		return;

	int key = arr[left];
	int _left = left + 1;
	int _right = right;
	while (_left < _right)
	{
		while (_left < _right && arr[_right] > key) --_right;
		while (_left < _right && arr[_left] <= key) ++_left;
		swap(arr[_left], arr[_right]);
	}
	swap(arr[left], arr[_left]);

	quick_sort(arr, left, _left - 1);
	quick_sort(arr, _left + 1, right);
}
int main()
{
	vector<int> v = { 3, 5, 6 ,9 ,7 ,1 ,10 ,2 ,4 ,0 , 6, 6, 6 };
	quick_sort(v, 0, v.size() - 1);
	for (auto i : v)
	{
		cout << i << " ";
	}
	cout << endl;
	return 0;
}